<template>
	<view>
		<cu-custom bgColor="bg-gradual-orange" :isBack="true">
			<block slot="content">会员升级</block>
		</cu-custom>
		<!-- <u-gap height="90" bg-color="#f5f5f5"></u-gap> -->
		<view class="goods-con">
			<goods-list :goodsList="productList"></goods-list>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import banlance from '@/api/banlance';
	// import navBar from '@/plugins/zhouWei-navBar/index'
	// import filterDropdown from '@/plugins/HM-filterDropdown.vue'
	import goodsList from '@/components/goods-list.vue'
	export default {
		components: {
			// navBar,
			// filterDropdown,
			goodsList
		},
		computed: {
			goodsHeaderTop() {
				try {
					const res = uni.getSystemInfoSync();
					return ((44 + res.safeAreaInsets.top) * 2)
				} catch (e) {
					return 88
				}
			},
			...mapState(['userInfo', 'hasLogin']),
			
		},
		data() {
			return {
				filterData: [],
				defaultSelected: [
					[null, null],
					[0],
				],
				productList: [

				],
			}
		},
		onLoad() {
			this.getProduct()
		},
		methods: {
			getProduct() {
				banlance.getProduct({}).then(res => {
					if (res.code == 1) {
						// this.applyList = res.data.list;
						this.productList = this.productList.concat(res.data);

						console.log(res);
					} else {
						console.log(res);
					}

				});
			},
			dropdownIsChange(_newIndex) {
				return JSON.stringify(_newIndex) != JSON.stringify(this.defaultSelected)
			},
			dropdownConfirm(_data) {
				if (this.dropdownIsChange(_data.index)) {
					console.log('变化了')
				}
			},
			goBack() {
				this.$myRouter.back()
			},
			goSearch() {
				this.$myRouter.push({
					name: 'goods/search'
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.goods-header {
		background-color: #FFF;
		position: fixed;
		width: 100%;
		z-index: 9;
		min-height: 80rpx;

		.goods-search {
			padding: 10rpx;
			border-bottom: 1px solid #f5f5f5;
			z-index: 999;
		}
	}

	.goods-con {
		padding-bottom: constant(safe-area-inset-bottom);
		padding-bottom: env(safe-area-inset-bottom);
	}

	.goods-list {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;

		.goods-item {
			background-color: #FFF;
			flex: 1 0 40%;
			margin: 10rpx;
			border-radius: 12rpx;
			overflow: hidden;
			transition: all 0.15s ease-in-out;

			.img {
				width: 100%;
				min-height: 362rpx;
			}

			.goods-item-content {
				padding: 20rpx;

				.title {
					color: #2e2e2e;
					font-size: 13px;
					min-height: 68rpx;
					word-break: break-all;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
				}

				.bottom {
					.price {
						padding-top: 9px;

						.sale-price {
							font-size: 17px;
							font-weight: 500;
							color: #e41f19;
						}

						.factory-price {
							font-size: 12px;
							color: #a0a0a0;
							text-decoration: line-through;
							padding-left: 6px;
						}
					}

					.buy-num {
						padding-top: 5px;
						font-size: 12px;
						color: #656565;
					}
				}
			}
		}
	}

	.nav-bar-left {
		padding-left: 10rpx;
		padding-top: 4rpx;
		width: 80rpx;
		text-align: center;
	}

	.goods-search {
		width: 89vw;
		padding-right: 20rpx;
		/* #ifdef MP */
		padding-right: 180rpx;
		width: 86vw;
		/* #endif */
	}

	.error-box {
		width: 100%;
		height: 360rpx;
		display: flex;
		justify-content: center;
	}
</style>